import 'package:flutter/material.dart';
import 'package:flutter_animation/More/widget/photo_list.dart';

import 'widget/TodoList/TodoListBean.dart';
import 'widget/Grid/GridDemo.dart';
import 'widget/Music/Music.dart';
import 'widget/StackDemo.dart';
import 'widget/TodoList/ListDemo.dart';
import 'widget/WrapDemo.dart';
import 'widget/Game/GamePage.dart';
import 'widget/HeroDemo.dart';

class More extends StatefulWidget {
  const More({super.key});

  @override
  State<More> createState() => _MoreState();
}

class _MoreState extends State<More> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("More"),
      ),
      body: Container(
        width: double.infinity,
        height: double.infinity,
        child: SingleChildScrollView(
          child: Column(
            children: [
              buildButtonItem('Hero', const HeroDemo()),
              buildButtonItem('Grid', const GridDemo()),
              buildButtonItem('Stack', const StackDemo()),
              buildButtonItem('Wrap', const WrapDemo()),
              buildButtonItem('2048', const GamePage()),
              buildButtonItem('Music', const MusicPage()),
              buildButtonItem('PhotoList', const PhotoList()),
              buildButtonItem(
                'List',
                ListDemo(
                  todos: List.generate(
                    9,
                    (i) => TodoBean(
                    '第$i条item',
                    '第$i条的描述',
                    ),
                  ),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }

  buildButtonItem(String title, Widget widget) {
    return TextButton(
      onPressed: () {
        Navigator.push(
          context,
          MaterialPageRoute(builder: (context) => widget),
        );
      },
      child: Text(title),
    );
  }
}
